package com.hb.study.design_patterns.proxy.dynamic_proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 代理的handler
 *
 * @author Mr.Huang
 * @version v0.1, GamePlayerHandler.java, 2020/5/14 16:35, create by huangbiao.
 */
public class GamePlayerHandler implements InvocationHandler {

    private Object target;

    public GamePlayerHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("前通知");
        Object result = method.invoke(this.target, args);
        System.out.println("后通知");
        return result;
    }

}

    